package org.jeecg.modules.demo.sermanager.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.sermanager.entity.NetptCategory;
import org.jeecg.modules.demo.sermanager.service.INetptCategoryService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;

import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;

 /**
 * @Description: netpt_category
 * @Author: jeecg-boot
 * @Date:   2022-02-08
 * @Version: V1.0
 */
@Api(tags="服务版本字典管理")
@RestController
@RequestMapping("/sermanager/netptCategory")
@Slf4j
public class NetptCategoryController extends JeecgController<NetptCategory, INetptCategoryService> {
	@Autowired
	private INetptCategoryService netptCategoryService;
	
	/**
	 */
	@AutoLog(value = "服务字典列表查询")
	@ApiOperation(value="服务字典列表查询", notes="服务字典列表查询")
	@GetMapping(value = "/listSer")
	public Result<?> querySerList(NetptCategory netptCategory,
								   HttpServletRequest req) {
		QueryWrapper<NetptCategory> queryWrapper = QueryGenerator.initQueryWrapper(netptCategory, req.getParameterMap());
		List<NetptCategory> pageList = netptCategoryService.list( queryWrapper);
		return Result.OK(pageList);
	}



	 /**
	  */
	 @AutoLog(value = "版本列表查询")
	 @ApiOperation(value="版本列表查询", notes="版本列表查询")
	 @GetMapping(value = "/listVer")
	 public Result<?> queryVerList(NetptCategory netptCategory,
								HttpServletRequest req) {
		 QueryWrapper<NetptCategory> queryWrapper = QueryGenerator.initQueryWrapper(netptCategory, req.getParameterMap());
		 List<NetptCategory> pageList = netptCategoryService.list( queryWrapper);
		 return Result.OK(pageList);
	 }

	
	/**
	 *   添加
	 *
	 * @param netptCategory
	 * @return
	 */
	@AutoLog(value = "netpt_category-添加")
	@ApiOperation(value="netpt_category-添加", notes="netpt_category-添加")
	@PostMapping(value = "/add")
	public Result<?> add(@RequestBody NetptCategory netptCategory) {
		netptCategoryService.save(netptCategory);
		return Result.OK("添加成功！");
	}
	
	/**
	 *  编辑
	 *
	 * @param netptCategory
	 * @return
	 */
	@AutoLog(value = "netpt_category-编辑")
	@ApiOperation(value="netpt_category-编辑", notes="netpt_category-编辑")
	@PutMapping(value = "/edit")
	public Result<?> edit(@RequestBody NetptCategory netptCategory) {
		netptCategoryService.updateById(netptCategory);
		return Result.OK("编辑成功!");
	}
	
	/**
	 *   通过id删除
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "netpt_category-通过id删除")
	@ApiOperation(value="netpt_category-通过id删除", notes="netpt_category-通过id删除")
	@DeleteMapping(value = "/delete")
	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
		netptCategoryService.removeById(id);
		return Result.OK("删除成功!");
	}
	
}
